import React, { Component } from 'react'
import {Form, Input, Button} from 'antd';
import "../../assets/style/login/login.css"


export default class Login extends Component {
  formRef = React.createRef();
  onFinish = (values) => {
    console.log(values);
    this.props.history.push("/home")
  };
  onFill = () => {
    this.formRef.current.setFieldsValue({
      note: 'Hello world!',
      gender: 'male',
    });
  };


  render() {
    return (
        <div className={"userLogin"}>
          <h1>欢迎使用同程优品</h1>
          <h3>后台管理系统</h3>
          <Form className={"loginForm"} ref={this.formRef} name="control-ref" onFinish={this.onFinish}>
            <Form.Item
                       name="userAccount"
                       label="账 号"
                       rules={[
                         {
                           required: true,
                           message:"请输入账号"
                         },
                       ]}
            >
              <Input />
            </Form.Item>
            <Form.Item
                       name="userPassword"
                       label="密 码"
                       rules={[
                         {
                           required: true,
                           message:"请输入密码"
                         },
                       ]}
            >
              <Input.Password />
            </Form.Item>
            <Form.Item>
              <Button type="primary" htmlType="submit">
                登录
              </Button>
              <Button type="link" htmlType="button" onClick={this.onFill}>
                忘记密码
              </Button>
            </Form.Item>
          </Form>
        </div>
    );
  }
}

